/**
 * Copyright (c) 2009-2011, chunquedong(YangJiandong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 
 * History:
 *     2010-05-05  Jed Young  Creation
 */
package chunmap.service;

import java.util.ArrayList;
import java.util.List;

import chunmap.view.layer.Layer;

public class Util {
	public static List<Layer> getLayersByName(List<Layer> layers,String name) {
		String[] s=name.split(",");
		for(Layer l:layers){
			if(inArray(l.getName(),s)){
				List<Layer> list=new ArrayList<Layer>();
				list.add(l);
				return list;
			}
		}
		return new ArrayList<Layer>();
	}
	
	private static boolean inArray(String name,String[] s){
		for(String t:s){
			if(name.equals(t)){
				return true;
			}
		}
		return false;
	}
}